<?php

namespace app\common\model;

class Banner extends \app\admin\model\Banner
{
    protected $append = [];

    public static function getHomeBanner()
    {
        return self::where('status', 'normal')
            ->where('position', 'home')
            ->order('weigh', 'asc')
            ->field('name, image, path')
            ->limit(4)
            ->select();
    }

    public function getImageAttr($val,$data){
        if($val){
            return cdnurl($val);
        }
        return '';
    }
}
